﻿using System;

namespace OpenLS.Spreadsheet.Formats.Biff.Records
{
    internal class DxGColRecord : WorksheetLevelRecord
    {
        private ushort _dxgCol;

        protected override void ReadContent(BiffReaderContext context, int length)
        {
            this._dxgCol = context.ReadUInt16();
        }

        internal override BiffRecordType RecordType
        {
            get { return BiffRecordType.DxGCol; }
        }

        internal override void Apply(BiffReaderWorksheetContext context)
        {
            context.Worksheet.DefaultCharacterWidth = (double) _dxgCol/256;
        }

        internal override void WriteContent(BiffWriterWorkbookContext context)
        {
            context.WriteUInt16(_dxgCol);
        }
    }
}